package com.sdyeda.readiot.fx;

import java.io.IOException;

import com.sdyeda.readiot.ReadIotApplication;
import com.sdyeda.readiot.config.Setting;

import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Modality;
import javafx.stage.Stage;

public class DetailWindow {

	private Scene scene;
	private DetailWindowController controller;

	public DetailWindow(Stage stage) {
		FXMLLoader loader = new FXMLLoader(DetailWindow.class.getResource("DetailWindow.fxml"));		

		try {
			scene = new Scene(loader.load());
			setController(loader.getController());
			Setting.Set(Setting.DETAILWINDOW_CONTROLLER, getController());

			stage.setScene(scene);
			stage.setTitle("尾矿库自动数据采集系统--传感器信息");
			stage.getIcons().add(new Image(MainWindow.class.getResourceAsStream("/logo.png")));
			stage.initOwner(ReadIotApplication.primaryStage);//s2 一直在 s1 的上面
			stage.initModality(Modality.WINDOW_MODAL);
			stage.setResizable(false);
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public DetailWindowController getController() {
		return controller;
	}

	public void setController(DetailWindowController controller) {
		this.controller = controller;
	}

}
